﻿#include <iostream>
#include <string>
#include <set>

#include <windows.h>  
#include <psapi.h> 
using namespace std;

class B
{
public:
    int *b;
public:
    B() 
    { 
        b = new int;
    };

    ~B() {
        cout <<"delete B" << endl;
        delete b;
    };
};

class A
{
public:
    B* a;
public:
    A() 
    { 
        a = new B();
    };

    ~A()
    {
        cout << "delete A" << endl;
        delete a;
    };
};

class C
{
public:
    A* a;
    B* b;
public:
    C() 
    {
    };
    ~C()
    {

    }
};

void showMemoryInfo(void)
{
    HANDLE handle = GetCurrentProcess();
    PROCESS_MEMORY_COUNTERS pmc;
    GetProcessMemoryInfo(handle, &pmc, sizeof(pmc));
    cout << "内存使用:" << pmc.WorkingSetSize / 1000 << "K  " << "峰值内存使用:" << pmc.PeakWorkingSetSize / 1000 << "K   " << "虚拟内存使用:" << pmc.PagefileUsage / 1000 << "K  " << "峰值虚拟内存使用:" << pmc.PeakPagefileUsage / 1000 << "K" << endl;
}


int main()
{
    //A* a = new A();
    //delete a;
};